package com.xbao.dao;

import com.xbao.model.StuAccount;
import com.xbao.model.req.PeriodReq;
import com.xbao.model.req.StuAccountReq;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * Created by qingshengzheng on 2019/1/24.
 */
@Mapper
public interface StuAccountExtraMapper {
    @Update("update set updatetime=#{updatetime},totalperiods=totalperiods+#{totalperiods},remainperiods=remainperiods+#{remainperiods}" +
            ",endtime=#{endtime} where sid=#{sid} and  subid=#{subid} ")
    public void recharge(StuAccount stuAccount);
    @Select("select sid,min(starttime) as starttime,max(endtime) as endtime,sum(totalperiods) as totalperiods,sum(remainperiods) as remainperiods from stu_account where sid=#{sid}")
    public StuAccount aggAccount (Long sid);
}
